//文件的写操作4
import java.io.*;
public class Demo15 {
    public static void main(String[] args) throws IOException {
        try(OutputStream out = new FileOutputStream("hello6.txt")){
            //用String.getBytes("utf-8")可以把String自动编码为UTF-8格式的byte[]
            byte[] b = "你好中国!".getBytes("utf-8");
            out.write(b); 
            out.flush(); //千万不要忘记flush
        }
    }
}
